package com.mxpio.erp.common.oa.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpio.erp.common.jpa.policy.ResCodeGeneratorPolicy;
import com.mxpioframework.filestorage.entity.MxpioFileInfo;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.Dept;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.util.Date;

@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_OA_SIGNATURE")
@Schema(description="签呈申请")
public class SignatureApplication extends BaseEntity {


    @Id
    @Column(name = "BIZ_NO_", updatable = false)
    @Generator(policy = ResCodeGeneratorPolicy.class)
    @Schema(description = "申请单编号")
    private String bizNo;

    @Column(name = "APPLY_ID_")
    @Schema(description = "申请人")
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String applyId;

    @Column(name = "APPLY_USER_DEPT_ID_")
    @Schema(description = "申请人部门")
    @Dict(dicCode = "deptCode", dicEntity = Dept.class, dicText = "deptName")
    private String applyUserDeptId;

    @Column(name = "APPLY_DATE_")
    @Schema(description = "签呈日期")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date applyDate;

    @Column(name = "SIGN_LEVEL_")
    @Schema(description = "件别") //1一般2机密3速件
    @Dict(dicCode = "MB_ERP_OA_SSA_SIGN_LEVEL")
    private String signLevel;

    @Column(name = "URGENCY_LEVEL_")
    @Schema(description = "紧急程度（星级）")
    private Integer urgencyLevel;

    @Column(name = "BUSI_CATEGORY_")
    @Schema(description = "业务分类") //1行政管理2认识薪酬3员工福利4其他
    @Dict(dicCode = "MB_ERP_OA_SSA_BUSI_CATEGORY")
    private String busiCategory ;

    @Column(name = "SIGN_TOPIC_")
    @Schema(description = "签呈主题")
    private String signTopic;

    @Column(name = "SUMMARY_",columnDefinition = "TEXT")
    @Schema(description = "签呈说明")
    private String summary;

    /**审批状态*/
    @Column(name = "BPMN_STATUS_")
    @Schema(description = "审批状态")
    @Dict(dicCode = "ERP_COMMON_BPMN_STATUS")
    private String bpmnStatus;

    /**审批实例ID*/
    @Column(name = "PROCESS_INSTANCE_ID_")
    @Schema(description = "审批实例ID")
    private String processInstanceId;

    @Column(name = "FILE_NO_",columnDefinition = "TEXT")
    @Schema(description = "附件")
    @Dict(dicCode = "fileNo", dicEntity = MxpioFileInfo.class, dicText = "fileName")
    private String fileNo;

    @Transient
    @Schema(description = "是否撤销审批")
    @Dict(dicCode = "ERP_COMMON_YESNO") //0否 1是
    private String revoke;

    @Column(name = "REVIEW_OPINIONS_",columnDefinition = "TEXT")
    @Schema(description = "审核意见")
    private String reviewOpinions;

    @Column(name = "PIC_",columnDefinition = "TEXT")
    @Schema(description = "图片")
    private String pic;
}
